Skip to content

Conversation

@urasakikeisuke
Copy link

This PR fixes a typo in the deprecation warning message of _VersionPydanticAnnotation.


warnings.warn(
'Use from pydantic_extra_types.semver import SemanticVersion instead. Will be removed in 3.0.0.', DeprecationWarning
'Use from pydantic_extra_types.semantic_version import SemanticVersion instead. Will be removed in 3.0.0.',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @urasakikeisuke the file name is semver so changing this pydantic_extra_types.semantic_version require changing the name of the file

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @yezz123! The guidance in the warning “from pydantic_extra_types.semver import SemanticVersion” led to the following ImportError.

>>> from pydantic_extra_types.semver import SemanticVersion
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    from pydantic_extra_types.semver import SemanticVersion
ImportError: cannot import name 'SemanticVersion' from 'pydantic_extra_types.semver' (/home/user/.venv/lib/python3.13/site-packages/pydantic_extra_types/semver.py)

When I imported as follows, the error did not occur.

>>> from pydantic_extra_types.semantic_version import SemanticVersion
>>> 

The SemanticVersion class is in semantic_version.py so the change is fine I think.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you miss changing the files here is the file you should update https://github.com/urasakikeisuke/pydantic-extra-types/blob/main/pydantic_extra_types/semantic_version.py

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is my take here, we can merge both of them because they are duplicated logic and we can keep one of them

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this got closed without resolving the issue; the "fix" instruction in the deprecation warning emitted in semver.py is incorrect, and this PR would have resolved it. semver.py is deprecated in favor of semantic_version.py, so the warning should be changed in the manner that was recommended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants